<?php if(!defined('BASEPATH')) exit ('No direct script access allowed');
class C_managedeposit extends CI_Controller{
	function __construct(){
		parent::__construct();
		$this->load->model('m_managedeposit');
	}
	function index(){
		$this->load->view('admin/pages/v_managedeposit');
	}
	function action(){
		$action = isset($_POST['action']) ? @$_POST['action'] : @$_GET['action'];
		switch($action){
			case "managedeposit_add":
				$this->managedeposit_add();
			break;
			case "managedeposit_edit":
				$this->managedeposit_edit();
			break;
			case "managedeposit_delete":
				$this->managedeposit_delete();
			break;
			case "updatedeposit":
				$this->updatedeposit();
			break;
			default:
				echo "{ failure : true }";
			break;
		}
	}
	function data_managedeposit(){
		$key = isset($_GET['key']) ? @$_GET['key'] : @$_POST['key'];
		$result = $this->m_managedeposit->data_managedeposit($key);
		echo "{\"results\":" .$result. "}";
	}
	function managedeposit_add(){
		$managedeposit_nama = trim(@$_POST['managedeposit_nama']);
		$managedeposit_keterangan = trim(@$_POST['managedeposit_keterangan']);
		$result = $this->m_managedeposit->managedeposit_add($managedeposit_nama,$managedeposit_keterangan);
		echo $result;
	}
	function managedeposit_edit(){
		$managedeposit_id = trim(@$_POST['managedeposit_id']);
		$managedeposit_nama = trim(@$_POST['managedeposit_nama']);
		$managedeposit_keterangan = trim(@$_POST['managedeposit_keterangan']);
		$result = $this->m_managedeposit->managedeposit_edit($managedeposit_id,$managedeposit_nama,$managedeposit_keterangan);
		echo $result;
	}
	function managedeposit_delete(){
		$managedeposit_id = trim(@$_POST['managedeposit_id']);
		$result = $this->m_managedeposit->managedeposit_delete($managedeposit_id);
		echo $result;
	}
	function updatedeposit(){
		$nominal_user = trim(@$_POST['nominal_user']);
		$validasi_idtiket = trim(@$_POST['validasi_idtiket']);
		$update_date = date('Y-m-d H:i:s');
		$result = $this->m_managedeposit->updatedeposit($nominal_user,$validasi_idtiket,$update_date);
		echo $result;
	}
}
?>